package com.wangsd.web.coupon.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 订单
 */
@Data
@Entity
@Table(name = "t_order")
@ApiModel(value = "订单", description = "订单信息")
public class TOrder implements Serializable {

    @Id
    @TableId(type = IdType.AUTO)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updatedTime;

    @TableField(fill = FieldFill.INSERT)
    private Integer deleted;

    @ApiModelProperty(value = "检索标识")
    private String code;

    @ApiModelProperty(value = "交易订单号")
    private String transactionId;

    @ApiModelProperty(value = "商户订单号")
    private String outTradeNo;

    @ApiModelProperty(value = "订单状态，0：未支付，1：已支付，2：支付失败，3：已退款")
    @Column(name = "order_status",columnDefinition = "int(10) default 0 not null")
    private Integer orderStatus;

    @ApiModelProperty(value = "服务商id")
    private Long businessServiceId;

    @ApiModelProperty(value = "商圈id")
    private Long companyId;

    @ApiModelProperty(value = "子商户id")
    private Long subMchId;

    @ApiModelProperty(value = "子商户名称")
    private String subMchName;

    @ApiModelProperty(value = "门店id")
    private Long storeId;

    @ApiModelProperty(value = "门店名称")
    private String storeName;

    @ApiModelProperty(value = "用户在子商户appid下的唯一标识")
    private String openid;

    @ApiModelProperty(value = "订单金额")
    @Column(name = "order_total_fee",columnDefinition = "int(20) default 0 not null")
    private Integer orderTotalFee;

    @ApiModelProperty(value = "实际支付金额")
    @Column(name = "real_pay_fee",columnDefinition = "int(20) default 0 not null")
    private Long realPayFee;

    @ApiModelProperty(value = "支付方式：1：微信支付，2：支付宝支付")
    @Column(name = "pay_type",columnDefinition = "int(10) default 0 not null")
    private Integer payType;

    @ApiModelProperty(value = "方式：0：未领取商家券，1：已领取商家券，2：已核销")
    @Column(name = "send_type",columnDefinition = "int(10) default 0 not null")
    private Integer sendType;



    @ApiModelProperty(value = "交易类型，1商品，2，商家券")
    private String tradeType;

    @ApiModelProperty(value = "微信完成支付时间")
    private String timeEnd;

    @ApiModelProperty(value = "商品id")
    private String productId;

    @ApiModelProperty(value = "商品名称")
    private String productName;

    @ApiModelProperty(value = "商品图片url")
    private String productPicUrl;

    @ApiModelProperty(value = "收货地址")
    private String address;

    @ApiModelProperty(value = "物流名称")
    private String expressName;

    @ApiModelProperty(value = "物流单号")
    private String expressNo;

    @ApiModelProperty(value = "物流状态(0，未发货；1，已发货；2，已完成)")
    private Integer expressStatus;

    @ApiModelProperty(value = "开始时间")
    @Transient
    @TableField(exist = false)
    @JsonFormat( pattern="yyyy-MM-dd HH:mm:ss")
    private Date beginTime;

    @ApiModelProperty(value = "结束时间")
    @Transient
    @TableField(exist = false)
    @JsonFormat( pattern="yyyy-MM-dd HH:mm:ss")
    private Date endTime;
}
